![]() |
MPThrowException |
||||
Header: | Multiprocessing.h | Carbon status: | Supported | |
Throws an exception to a specified task.
OSStatus MPThrowException ( MPTaskID task, MPExceptionKind kind );
The task to which the exception should be thrown.
The type of exception to give to the task.
A result code. If the task is already suspended or if the task is not defined to take thrown exceptions, the function returns kMPInsufficientResourcesErr.
The exception is treated in the same manner as any other exception taken by a task. However, since it is asynchronous, it may not be presented immediately.
By convention, you should set the exception kind to kMPTaskStoppedErr if you want to suspend a task. In general, you should do so only if you are debugging and wish to examine the state of the task. Otherwise you should block the task using one of the traditional notification mechanisms (such as a message queue).
An exception can be thrown at any time, whether that task is running, eligible to be run (that is, ready), or blocked. The task is suspended and an exception message may be generated the next time the task is about to run. Note that this may never occur— for example, if the task is deadlocked or the resource it is waiting on is never released. If the task is currently blocked when this function is executed, kMPTaskBlockedErr is returned. If the task was suspended immediately at the conclusion of this function call the return value is kMPTaskStoppedErr.
Introduced with Multiprocessing Services 2.0.
Supported in Carbon. Available in CarbonLib 1.0 and later when MPLibrary 2.0 or later is installed. Exported by CarbonLib 1.0 and later and by MPLibrary 2.0 and later.
© 2000 Apple Computer, Inc. — (Last Updated 4/6/2000)